package org.filters;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class Cutout implements Filter{
    public void applyFilter(String imagePath){
        Mat src = Imgcodecs.imread(imagePath);
        Mat gray = new Mat();
        Imgproc.cvtColor(src, gray, Imgproc.COLOR_BGR2GRAY);
        Imgproc.GaussianBlur(gray, gray, new Size(3, 3), 0);
        Mat edges = new Mat();
        Imgproc.Canny(gray, edges, 50, 150);
        Mat dst = new Mat();
        Core.bitwise_not(edges, dst);
        Imgcodecs.imwrite("output_cutout.jpg", dst);
        System.out.println("Cutout filter applied.");
    }
}
